﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Configuration;

namespace WEALTH
{
    public partial class SiteMaster : System.Web.UI.MasterPage
    {
        public string strMenuSub1 = string.Empty;
        public string strusername = string.Empty;
        public string strGetSiteDnsName = string.Empty;
        public bool isLogin = false;
        public string strJifen = "0";
        private ExcuteDao dao = new ExcuteDao();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session[SessionKeys.CURRENT_MEMBER]!=null)
            {
                strJifen = ((MemberCurrent)Session[SessionKeys.CURRENT_MEMBER]).M_Number.ToString();
                strusername = ((MemberCurrent)Session[SessionKeys.CURRENT_MEMBER]).M_Name;
                isLogin = true;
            }
            else
            {
                isLogin = false;
            }
            strGetSiteDnsName = ConfigurationManager.AppSettings["SiteDnsName"].ToString();
            SetMenu();
        }

        /// <summary>
        /// 设置动态菜单，如果二级菜单全部都是列表和内容页的表现形式则加入到这个方法中
        /// </summary>
        private void SetMenu()
        {
            #region strMenuSub1

            DataTable dt = dao.Get_LeftMenuALL("", "关于我们");
            strMenuSub1 = string.Empty;
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                int intMenuID = Convert.ToInt32(dt.Rows[i]["MenuID"]);
                string strmenuname = dt.Rows[i]["MenuName"].ToString();
                DataTable menuDt = dao.Get_ListALL("", "", intMenuID, "");

                if (menuDt.Rows.Count == 1)
                {
                    int listid = Convert.ToInt32(menuDt.Rows[0]["listID"]);
                    //strMenuSub1 += "<li><a href=\"#\" title=\"\">公司介绍</a></li>";
                    strMenuSub1 += "<li><a href=\"ListView.aspx?listviewid="
                    + listid + "&menutype=关于我们\" title=\"\">" + strmenuname + "</a></li>";
                }
                else
                {
                    //strMenuSub1 += "<li><a href=\"#\" title=\"\">公司介绍</a></li>";
                    strMenuSub1 += "<li><a href=\"List.aspx?menuid="
                        + intMenuID + "&menutype=关于我们\" title=\"\">" + strmenuname + "</a></li>";
                }
            }

            #endregion

        }
    }
}
